package com.amit.struts;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.validator.DynaValidatorForm;

public class RequestAction extends JLCBaseAction {
	
	
	public ActionForward postRequest(ActionMapping am,ActionForm af,HttpServletRequest req,HttpServletResponse res)throws
	Exception
	{
		
		DynaValidatorForm dvf=(DynaValidatorForm) af;
		
		String pr=dvf.get("priority").toString();
		String de=dvf.get("description").toString();
		
		RequestTO rto=new RequestTO();
		
	     rto.setPriority(pr);
	     rto.setDescription(de);
		
		HttpSession session=req.getSession();
		
		EmployeeTO eto=(EmployeeTO) session.getAttribute("ETO");
		rto.setEmpId(eto.getEmpId());
		rto.setStatus("New");
		
		int rid=requestService.postRequest(rto);
		session.setAttribute("RID", rid);
		return am.findForward("PostRequestSuccess");
		
	}

}
